<script type="text/javascript">
function ChangeBulkAction(v)
{	
    if(document.getElementById(v).value == 'status')
   		document.getElementById("changestatus").style.display="inline";
   	else
   		document.getElementById("changestatus").style.display="none";
}
function ChangeStatus(s)
{
	if(document.getElementById("changestatus").value == 'unpublished')
   		document.getElementById("reason").style.display="inline";
   	else
   		document.getElementById("reason").style.display="none";
}

$(function() {
    $("table tr:nth-child(odd)").addClass("striped");//.hover(function(){this.removeClass("striped")});
});



</script>

<style>
    tr.striped {
        background-color: #EEEEEE;
}
</style>

<form action="/en/block/index/bulk" method="POST">
<table border = '1' width='900px'>
	<tr>
		<td>
			
		</td>
		<td>
			ID
		</td>
		<td>
			name
		</td>
<!-- 
		<td>
			Type
		</td>
 -->      
		<td>
			Lang
		</td>
        <td>
            Themes
        </td>
        <td width="20%">
            Roles
        </td>
        <td width="20%">
            Module
        </td>
		<td>
			Positions
		</td>
        <td width="10%">
            Operations
        </td>
	</tr>
	<?if(isset($this->blockList)) :?>
	<? foreach ($this->blockList as $row) :?>
	<tr>
		<td>
			<input type="checkbox" value="<?=$row['id'] ?>" id="edit-block-<?=$row['id'] ?>" name="blocks[<?=$row['id'] ?>]"/>
		</td>
		<td>
			#<?=$row['id']?>
		</td>
		<td>
			<a href="/en/block/index/view?id=<?=$row['id']?>" > <?=$row['name'] ?></a>
		</td>
<!--         
		<td>
			<?=$row['type'] ?>
		</td>
 -->            
		<td>
			<?=$row['languages'] ?>
		</td>
        <td>
            <?=str_replace(',' , '<br/>', $row['themes']) ?>
        </td>
        <td>
            <?=$row['roleNames'] ?>
        </td>
        <td>
            <?=str_replace(',' , '<br/>', $row['modules']) ?>
        </td>
        <td>
            <?= str_replace(':' , ':<br/>', $row['positions']) ?>
        </td>

    	<td><a href="/en/block/index/edit?id=<?=$row['id']?>">edit</a>
            <a href="/en/block/index/delete?id=<?=$row['id']?>">delete</a>
        </td> 
	</tr>
			
	<?endforeach ?>
	<?endif?>
</table>
<br />
<div  style="background-color:#EEEEEE">

Bulk Operation: 
<select name='bulkaction' id ="bulk" onchange = "ChangeBulkAction('bulk')">
<option value='delete'> delete </option>
<option value='status'> set status </option>
</select>

<select name='changestatus' id ="changestatus" style=" display:none" onchange = "ChangeStatus('changestatus')">
<option value='published'> published </option>
<option value='queued'> queued </option>
<option value='unpublished'> unpublished </option>
<option value='deleted'> deleted </option>
</select>
<input type="text" id="reason" style="display:none" name='reason'/>
<input type="submit" value="Apply" id="edit-submit" name="op"/>
</div>
</form>
<br/>
Create a new block <a href="/en/block/index/new"> here </a>
